<?php
//lisitra Component//
/**
* Content code
* @package lisitra
* @Copyright (C) 2006 Hery
* @ All rights reserved
* @ Released copyrighted
* @version 0.1
**/

// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );

/**
* @package Joomla
* @subpackage Lisitras
*/
class HTML_lisitra {

	/**
	* Display Table of items
	*/
	function showlisitra( &$params, &$rows, $tabclass, &$menu_params ) {
		global $mosConfig_live_site;
		// icon in table display
		?>
		<div class="componentheading<?php echo $menu_params->get( 'pageclass_sfx' ); ?>">
			<?php echo $menu_params->get( 'header', _LISITRA ); ?>
		</div>

		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<?php

		$k = 0;
		foreach ($rows as $row) {
			//$iparams = new mosParameters( $row->params );

			$link = sefRelToAbs( 'index.php?option=com_lisitra&task=view&id='. $row->id );
			$link = ampReplace( $link );
			
			$menuclass = 'lisitra'.$menu_params->get( 'pageclass_sfx' );
     			?>
			<tr class="<?php echo $tabclass[$k]; ?>">
				<td height="20">
				<b><a href="<?php echo $link ;?>"><?php echo $row->title ; ?></a></b>
					<br />
					<?php echo $row->description; ?>
				</td>
				<td align="center">
					<?php echo $row->email; ?>
				</td>
			</tr>
			<?php
			$k = 1 - $k;
		}
		?>
		</table>
		<?php
	}



	function showItem( $option, &$row, &$params ){
		global $mosConfig_live_site;
		// icon in table display
		?>


		<script language="JavaScript" type="text/javascript">
		<!--
		function validate(){
			if ( ( document.adminForm.task.value == "" ) || ( document.adminForm.adiresy.value.search("@") == -1 ) || ( document.adminForm.adiresy.value.search("[.*]" ) == -1 ) ) {
				alert( "<?php echo _LISITRA_FORM_NC; ?>" );
			} else {
			document.adminForm.action = "<?php echo sefRelToAbs("index.php?option=com_lisitra&Itemid=$Itemid"); ?>"
			document.adminForm.submit();
			}
		}
		//-->
		</script>

		<form action="<?php echo sefRelToAbs("index.php"); ?>" method="post" name="adminForm" id="adminForm">

		<div class="componentheading<?php echo $params->get( 'pageclass_sfx' ); ?>">
		<?php echo $row->title; ?>
		</div>
		<div class="contentdescription<?php echo $params->get( 'pageclass_sfx' ); ?>" colspan="2">
		<?php echo $row->description; ?>
		</div>
		<div class="contentpane<?php echo $params->get( 'pageclass_sfx' ); ?>">


		<label for="anarana">
			<?php echo(_LISITRA_NAME_PROMPT);?>
		</label>
		<br />
		<input type="text" name="anarana" id="anarana" size="30" class="inputbox" value="" />
		<br />
		<label for="contact_email">
			<?php echo(_LISITRA_EMAIL_PROMPT);?>
		</label>
		<br />
		<input type="text" name="adiresy" id="adiresy" size="30" class="inputbox" value="" />
		<br />

		<input type="radio" name="task" id="subscribe" value="subscribe" checked />
		<label for="subscribe">
			<?php echo(_LISITRA_SUBSCRIBE); ?>
		</label>
		<br />
		<input type="radio" name="task" id="unsubscribe" value="unsubscribe"  />
		<label for="unsubscribe">
			<?php echo(_LISITRA_UNSUBSCRIBE); ?>
		</label>
		<br />
		<br />

		<input type="button" name="send" value="<?php echo(_SEND_BUTTON); ?>" class="button" onclick="validate()" />
		<input type="hidden" name="id" value="<?php echo $row->id; ?>" />
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		</div>
		</form>
		<?php		
	}
}
?>